{extend name="mainadmin@layouts/base" /}

{block name="main" }
<header class="header  b-b clearfix">

    <div class="page-breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <i class="fa fa-ellipsis-v"></i>
                <strong>添加礼物</strong>
            </li>
        </ul>
        <a class="text-muted pull-right m-t-md m-r pointer" data-toggle="back" title="返回"><i
                class="fa fa-reply"></i></a>
    </div>

</header>
<form class="form-horizontal form-validate form-modal form_vbox" method="post" action="{:url('info')}">
<section class="vbox">
    <section class="scrollable wrapper w-f ">
        <section class="panel panel-default ">
            <div class="widget-body">
                <div class="collapse in">
                    <div class="form-group">
                        <label class="control-label col-sm-2">礼物名称</label>
                        <div class="col-sm-6 m-t-md">
                            <input type="text" class="input-xlarge" name="gift_name" minlength="1" maxLength="6" data-rule-required="true" value="{$row.gift_name}">
                            <span class="tooltip-darkorange fa fa-question-circle" data-toggle="tooltip"  data-placement="bottom" data-html="true" data-original-title="礼物名称，最短1个汉字，最长6个汉字，1个汉字相当于2个字符"></span>
                        </div>

                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-2">礼物价格</label>
                        <div class="col-sm-6 m-t-md">
                            <input type="number" class="input-xlarge" name="gift_price" min="1" data-rule-required="true" value="{$row.gift_price}">
                            <span class="tooltip-darkorange fa fa-question-circle" data-toggle="tooltip"  data-placement="bottom" data-html="true" data-original-title="礼物价格"></span>
                        </div>

                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-2">礼物图片</label>
                        <div class="col-sm-6 ">
                            <div class="defUpImgBox"  data-toggle="uploaderImg" style="width: 130px; height: 130px">
                                <img  src="{$row.gift_img|default='__STATIC__/main/img/image.png'}">
                                <input type="hidden"  name="gift_img"  value="{$row.gift_img}">
                                <div class="tips">点击上传</div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-sm-2">动画类型</label>
                        <div class="col-sm-6 ">
                            <label class="radio-inline">
                                <input name="swftype" value="0" {$row['swftype']==0?'checked':''}  type="radio" >PNG
                            </label>
                            <label class="radio-inline">
                                <input name="swftype" value="1" {$row['swftype']==1?'checked':''}  type="radio" >GIF
                            </label>
                            <label class="radio-inline">
                                <input name="swftype" value="2" {$row['swftype']==2?'checked':''}  type="radio" >SVGA
                            </label>
                        </div>
                    </div>

                    <div id="gif-box" class="form-group" style="display: {$row['swftype']!=2?'block':'none'}">
                        <label class="control-label col-sm-2">动画图片</label>
                        <div class="col-sm-6 ">
                            <div class="defUpImgBox"  data-toggle="uploaderImg" style="width: 130px; height: 130px">
                                <img  src="{$row.swf|default='__STATIC__/main/img/image.png'}">
                                <input type="hidden"  name="swf"  value="{$row.swf}">
                                <div class="tips">点击上传</div>
                            </div>
                        </div>
                    </div>
                    <div id="svga-box" class="form-group" style="display: {$row['swftype']==2?'block':'none'}">
                        <label class="control-label col-sm-2">SVGA图片</label>
                        <div class="col-sm-6 " data-type="svga"
                             data-file_type="svga"
                             data-toggle="uploaderOne">
                            <input readonly type="text" class="input-xlarge" placeholder="点击上传SVGA文件"  name="svga_swf"  value="{$row.swf}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-2">动画时长</label>
                        <div class="col-sm-6 m-t-md">
                            <input type="number" class="input-xlarge" name="swftime" min="0.00" data-rule-required="true" value="{$row.swftime}">
                            <span class="tooltip-darkorange fa fa-question-circle" data-toggle="tooltip"  data-placement="bottom" data-html="true" data-original-title="动画时长,动画展示时间(单位:秒)"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-2">礼物排序</label>
                        <div class="col-sm-6 m-t-md">
                            <input type="number" class="input-xlarge" name="list_order" min="0" data-rule-required="true" value="{$row.list_order|default='0'}">
                            <span class="tooltip-darkorange fa fa-question-circle" data-toggle="tooltip"  data-placement="bottom" data-html="true" data-original-title="礼物排序,降序排列,序号大的在前面"></span>
                        </div>
                    </div>
                </div>

            </div>
        </section>
    </section>
    <footer class="footer bg-white b-t p-t">
        <div class="form-group">
            <div class="col-sm-4 col-sm-offset-1">
                <input name="id" type="hidden" value="{$row.id|intval}">
                <button type="submit" class="btn btn-primary js_save_submit" data-loading-text="保存中...">保存</button>
                <button type="button" class="btn btn-default" data-toggle="back">取消</button>
            </div>
        </div>
    </footer>
</section>
</form>
<script>
    function assigBack(file,media_id, back_dom) {
        $('#'+back_dom+'_img').attr('src',file);
        $('#'+back_dom+'_input').val(media_id);
        $(".modal-dialog .close").trigger("click");
    }

    $('input[name="swftype"]').on('click', function () {
        if ($(this).val() == 2) {
            $('#gif-box').hide();
            $('#svga-box').show();
        }else {
            $('#svga-box').hide();
            $('#gif-box').show();
        }
    })

</script>
{/block}